#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t,n,m, xa,xb,xc,xd,ya,yb,yc,yd;
int main(void){
    scanf("%I64d",&t);
    while(t--){
        scanf("%I64d%I64d",&n,&m);
        ll w,b;
        if(n%2==0 || m%2==0){
            w=b=(n*m/2);
        }else{
            w=(n*m/2)+1;
            b=(n*m/2);
        }
        scanf("%I64d%I64d%I64d%I64d",&xa,&ya,&xb,&yb);
        scanf("%I64d%I64d%I64d%I64d",&xc,&yc,&xd,&yd);
        // if(xa>xb){
        //     swap(xa,xb);
        // }
        // if(ya>yb){
        //     swap(xa,xb);
        // }
        // if(xc>xd){
        //     swap(xc,xd);
        // }
        // if(yc>yd){
        //     swap(yc,yd);
        // }
        ll wab=abs(xb-xa)+1;
        ll hab=abs(yb-ya)+1;
        ll wcd=abs(xd-xc)+1;
        ll hcd=abs(yd-yc)+1;
        //printf("%d %d %d %d\n",wab,hab,wcd,hcd);
        //white
        ll cnt=0;
        //first
        if(wab%2==0 || hab%2==0){
            cnt+=(wab*hab/2);
        }else{
            if((xa+ya)%2){
                cnt+=(((wab*hab)-1)/2+1);
            }else{
                cnt+=(((wab*hab)-1)/2);
            }
        }
        //printf("%d\n",cnt);
        //second
        if(wcd%2==0 || hcd%2==0){
            cnt-=(wcd*hcd/2);
        }else{
            if((xc+yc)%2){
                cnt-=(((wcd*hcd)-1)/2);
            }else{
                cnt-=(((wcd*hcd)-1)/2+1);
            }
        }
        //printf("%I64d\n",cnt);
        //相交
        bool flag=true;
        //printf("%I64d %I64d %I64d %I64d\n",max(xa,xb),min(xc,xd),max(ya,yb),min(yc,yd));
        if(max(xa,xb)<min(xc,xd) || max(ya,yb)<min(yc,yd) || max(xc,xd)<min(xa,xb) || max(yc,yd)<min(ya,yb)){
            flag=false;
        }
        if(flag){
            ll xe=max(xa,xc);
            ll ye=max(ya,yc);
            ll xf=min(xb,xd);
            ll yf=min(yb,yd);
            ll wef=abs(xf-xe)+1;
            ll hef=abs(yf-ye)+1;
            //printf("%I64d %I64d\n",wef,hef);
            if(wef%2==0 || hef%2==0){
                cnt-=(wef*hef/2);
            }else{
                if((xe+ye)%2){
                    cnt-=(((wef*hef)-1)/2+1);
                }else{
                    //printf("%I64d\n",(wab*hab));
                    cnt-=(((wef*hef)-1)/2);
                }
            }
        }    
        //printf("%I64d\n",cnt);
        printf("%I64d %I64d\n",w+cnt,b-cnt);
    }
    return 0;
}